/**
 *
 */
package com.angel.architecture.services;

import org.junit.Test;

import com.angel.architecture.BaseArchitectureTestCase;
import com.angel.architecture.constants.ArchitectureServicesNames;

/**
 * @author William
 *
 */
public class ArchitectureServiceTestCase extends BaseArchitectureTestCase {

	@Test
	public void testInitializeSpringApplicationContext(){
		ActionService actionService = (ActionService) super.getBean(ArchitectureServicesNames.ACTION_SERVICE_NAME);
		ConfigurationParameterService configurationParameterService = (ConfigurationParameterService) super.getBean(ArchitectureServicesNames.CONFIGURATION_PARAMETER_SERVICE_NAME);
		ErrorMessageService errorMessageService= (ErrorMessageService) super.getBean(ArchitectureServicesNames.ERROR_MESSAGE_SERVICE_NAME);
		LanguageService languageService = (LanguageService) super.getBean(ArchitectureServicesNames.LANGUAGE_SERVICE_NAME);
		MultipleService multipleService = (MultipleService) super.getBean(ArchitectureServicesNames.MULTIPLE_SERVICE_NAME);
		RoleService rolService = (RoleService) super.getBean(ArchitectureServicesNames.ROLE_SERVICE_NAME);
		SecurityService securityService = (SecurityService) super.getBean(ArchitectureServicesNames.SECURITY_SERVICE_NAME);
		UserService userService = (UserService) super.getBean(ArchitectureServicesNames.USER_SERVICE_NAME);

		assertNotNull("Action service must be not null.", actionService);
		assertNotNull("Configuration parameter service must be not null.", configurationParameterService);
		assertNotNull("Error message service must be not null.", errorMessageService);
		assertNotNull("Language service must be not null.", languageService);
		assertNotNull("Multiple service must be not null.", multipleService);
		assertNotNull("Rol service must be not null.", rolService);
		assertNotNull("Security service must be not null.", securityService);
		assertNotNull("User service must be not null.", userService);
	}

	@Test
	public void testDAOInjectionSpringApplicationContext(){
		ActionService actionService = (ActionService) super.getBean(ArchitectureServicesNames.ACTION_SERVICE_NAME);
		ConfigurationParameterService configurationParameterService = (ConfigurationParameterService) super.getBean(ArchitectureServicesNames.CONFIGURATION_PARAMETER_SERVICE_NAME);
		ErrorMessageService errorMessageService= (ErrorMessageService) super.getBean(ArchitectureServicesNames.ERROR_MESSAGE_SERVICE_NAME);
		LanguageService languageService = (LanguageService) super.getBean(ArchitectureServicesNames.LANGUAGE_SERVICE_NAME);
		MultipleService multipleService = (MultipleService) super.getBean(ArchitectureServicesNames.MULTIPLE_SERVICE_NAME);
		RoleService rolService = (RoleService) super.getBean(ArchitectureServicesNames.ROLE_SERVICE_NAME);
		SecurityService securityService = (SecurityService) super.getBean(ArchitectureServicesNames.SECURITY_SERVICE_NAME);
		UserService userService = (UserService) super.getBean(ArchitectureServicesNames.USER_SERVICE_NAME);

		assertNotNull("Action service dao must be not null.", actionService.getGenericDAO());
		assertNotNull("Configuration parameter dao service must be not null.", configurationParameterService.getGenericDAO());
		assertNotNull("Error message service dao must be not null.", errorMessageService.getGenericDAO());
		assertNotNull("Language service dao must be not null.", languageService.getGenericDAO());
		assertNull("Multiple service dao must be null.", multipleService.getGenericDAO());
		assertNotNull("Rol service dao must be not null.", rolService.getGenericDAO());
		assertNull("Security service dao must be not null.", securityService.getGenericDAO());
		assertNotNull("User service dao must be not null.", userService.getGenericDAO());
	}
}
